package j02zhengze;

public class J1 {
    public static void main(String[] args) {
        String s1 = "abc";
        //true
        System.out.println(s1.matches("abc"));
        //
        System.out.println("abc".matches("a.c"));
        System.out.println("azc".matches("a.c"));

        System.out.println("==[]==");
        System.out.println("abc".matches("a[xyz]c"));//false
        System.out.println("abc".matches("a[xyzb]c"));//true

        System.out.println("abc".matches("a(林冲|武松|高|求)c"));//false
        System.out.println("a武松c".matches("a(林冲|武松|高|求)c"));//true
        System.out.println("a高c".matches("a(林冲|武松|高|求)c"));//true
        System.out.println("==次数==");
        System.out.println("abc".matches("ab{2}c"));//false
        System.out.println("abbc".matches("ab{2}c"));//true
        System.out.println("abbbbbbbbc".matches("ab{2,}c"));//true
        System.out.println("abbbbbbbbbbbbbbc".matches("ab{2,}c"));//true
    }
}

class J2{
    public static void main(String[] args) {
        System.out.println("abc".matches("a[^耀]c"));
        System.out.println("a耀c".matches("a[^耀乐]c"));//false
        System.out.println("a乐c".matches("a[^耀乐]c"));//false
        System.out.println("amc".matches("a[^耀乐]c"));//true
        System.out.println("====");
        System.out.println("a1c".matches("a[0123456789]c"));
        System.out.println("a8c".matches("a[0-9]c"));
        System.out.println("azc".matches("a[0-9]c"));//false
        System.out.println("aMc".matches("a[0-9a-zA-Z]c"));//true
        System.out.println("a!c".matches("a[0-9a-zA-Z]c"));//false
        System.out.println("==?*+==");
        System.out.println("ac".matches("ab+c"));//false
        System.out.println("abc".matches("ab+c"));//true
        System.out.println("abbbbbbc".matches("ab+c"));//true
        System.out.println("==?===");
        System.out.println("abc".matches("ab?c"));//true
        System.out.println("ac".matches("ab?c"));//true
        System.out.println("abbc".matches("ab?c"));//false
    }
}